package com.slz3.business.module.socialManagement.socLife.service;

import com.slz3.business.frame.module.Repositorys;
import com.slz3.business.module.socialManagement.socLife.domain.SocLife;
import com.slz3.business.module.socialManagement.socLife.domain.SocLifeFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;

@Slf4j
@Service
public class SocLifeTransactionalServiceImpl implements SocLifeTransactionalService {

    @Override
    public SocLife modify(SocLife socLifeNew) {
        Repositorys.socLife.test();
        Repositorys.socLife.save(SocLifeFactory.initBaseFields());
        System.err.println(1/0);
        socLifeNew.setLastModifyTime(LocalDateTime.now());
        return Repositorys.socLife.saveAndFlush(socLifeNew);
    }

    @Override
    public List<SocLife> batchModify(List<SocLife> socLifeList) {
        return Repositorys.socLife.saveAll(socLifeList);
    }
}
